﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Core.Rules
{
    class CodePresentInReplies_Rule : IRule
    {
        public double apply(SiteEnum site, QuestionInformation info)
        {
            int postsWithCode = 0;
            foreach (var reply in info.Replies)
            {
                if (reply.ContainsSourceCode) postsWithCode++; // add "1" for each post that contains source code
            }
            return postsWithCode;
        }

        public string RuleName
        {
            get { return "CodePresentInReplies_Rule"; }
        }
    }
}
